﻿import Advantage.Data.Provider
import System.Data 
from Advantage.Data.Provider import *
from System.Data import CommandBehavior
class AdvantageIPy:
	
	def __init__(self):
		pass
	
	def connCreate(self,cConnString):
		_conn = AdsConnection(cConnString)
		_conn.Open()
		return _conn
	
	def sqlSelect(self,oConn,cSQL):
		_cmd = oConn.CreateCommand() 
		_cmd.CommandText = cSQL
		_reader = _cmd.ExecuteExtendedReader()
		_oSchema = _cmd.ExecuteExtendedReader(CommandBehavior.SchemaOnly)
		return _reader
	
	def tableOpen(self,oConn,cTable):
		_cmd = AdsCommand(cTable,oConn)
		_oCommandType = CommandType()
		print "what is the command type value?"
		print _oCommandType.TableDirect
		raw_input()
		_cmd.CommandType = _oCommandType.TableDirect
		_reader = _cmd.ExecuteExtendedReader()
		_oSchema = _cmd.ExecuteExtendedReader(CommandBehavior.SchemaOnly)
		return _reader
	

